Skip to content

fix(windows): 主窗口改为不透明——消除录音时 DWM/GPU 饱和导致的系统卡顿 - #882

Merged
H-Chris233 merged 1 commit into
Open-Less:betafrom
H-Chris233:codex/windows-main-window-opaque
Aug 2, 2026
Merged

fix(windows): 主窗口改为不透明——消除录音时 DWM/GPU 饱和导致的系统卡顿#882
H-Chris233 merged 1 commit into
Open-Less:betafrom
H-Chris233:codex/windows-main-window-opaque

Conversation

@H-Chris233

@H-Chris233 H-Chris233 commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

User description

问题

Windows 版录音期间出现三个症状(用户报告,v1.3.14):

  1. 录音时其他软件全部无响应
  2. 软件本身偶尔莫名卡死(后端日志无停顿,卡在渲染/UI 层)
  3. 录音时右键任务栏图标 → GPU 占用猛增

根因

tauri.conf.jsonmain 窗口(1240×800)为 transparent: true,导致 WebView2 内容整页走 per-pixel alpha 分层合成。但主窗口 UI 所有大面积层(winchrome / shell / sidebar / 内容区)都是不透明背景--ol-window-bg--ol-app-shell-bg--ol-sidebar-bg--ol-surface),Windows 的 Mica 磨砂(apply_mica)实际被完全盖住——透明是纯 GPU 成本、零视觉收益。

录音期间叠加胶囊窗口 60fps WebGL(SiriGL)+ 30Hz capsule:state 事件,GPU/DWM 被拖到饱和后:

  • DWM 无法按时合成其他应用的帧 → 其他软件"无响应"
  • 任务栏右键触发缩略图生成 / 强制重合成透明分层窗口 → GPU 飙升

佐证:日志分析显示 3 个月 356 次录音会话中音频回调零停滞——卡死不在后端,而在 WebView2 渲染/合成层,与 DWM 饱和模型一致。

改动

新增 tauri.windows.conf.json 平台覆盖(与既有 tauri.linux.conf.json 同机制):

  • main 窗口 transparent: true → false(唯一行为变化)
  • capsule 窗口保持 transparent: true(真透明浮窗,纯光效无底,视觉依赖 alpha)
  • macOS / Linux 不受影响

注意:Tauri 平台配置合并用 json_patch::merge(RFC 7386),数组整体替换,因此平台文件必须完整列出所有窗口。

验证建议

  • 录音时对比任务管理器 GPU 占用(改动前 vs 后)
  • 确认其他软件录音期间不再卡顿
  • 确认主窗口视觉无变化(UI 全不透明,Mica 本就不可见)

PR Type

Bug fix


Description

  • Add Windows platform override disabling main window transparency

  • Prevent per-pixel alpha compositing that saturated GPU/DWM

  • Preserve capsule window transparency for overlay UI

  • Reduce system-wide stutter during recording on Windows


Diagram Walkthrough

flowchart LR
  A["tauri.windows.conf.json"] --> B["main window transparent: false"]
  A --> C["capsule window transparent: true"]
  B --> D["No per-pixel alpha compositing"]
  C --> E["Preserved capsule overlay"]
  D --> F["Reduced GPU/DWM load"]
Loading

File Walkthrough

Relevant files
Configuration changes
tauri.windows.conf.json
Add Windows config disabling main window transparency       

openless-all/app/src-tauri/tauri.windows.conf.json

  • Add Windows-specific Tauri config platform override
  • Set main window transparent to false with shadow enabled
  • Keep capsule window transparent, alwaysOnTop, and skipTaskbar
  • Mirror main window dimensions, title bar style, and visibility flags
+44/-0   

主窗口 transparent:true 使 WebView2 内容整页走 per-pixel alpha 分层合成,
但 UI 所有大面积层(winchrome/shell/sidebar/内容区)都是不透明背景,
Mica 磨砂实际被完全盖住,透明是纯 GPU 成本零视觉收益。

录音期间叠加胶囊 60fps WebGL + 30Hz 事件,DWM 被拖到饱和时:
- 其他软件合成帧送不出去 → 全局无响应
- 任务栏右键触发缩略图/重合成 → GPU 飙升

新增 tauri.windows.conf.json 平台覆盖(json_patch 数组整体替换,
必须完整列出窗口),main 窗口 transparent:false,capsule 保留透明。
macOS/Linux 不受影响。参考 tauri.linux.conf.json 既有先例。
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@H-Chris233
H-Chris233 merged commit cfd99be into Open-Less:beta Aug 2, 2026
5 checks passed
@H-Chris233
H-Chris233 deleted the codex/windows-main-window-opaque branch August 3, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant